﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Database.Model.Customers>" %>

<%@ Import Namespace="CRM.Database.Model" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%: CRM.Resourses.Resourses.NewCustomerCreation %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2><%: CRM.Resourses.Resourses.NewCustomerCreation %></h2>

<script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>


<div>
    <%: Html.ActionLink(CRM.Resourses.Resourses.BackToList, "Index") %>
</div>

<% using (Html.BeginForm()) { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset style="max-width:500px;">
        <legend><%: CRM.Resourses.Resourses.NewCustomer %></legend>

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.CustomerName %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.Name) %>
            <%: Html.ValidationMessageFor(model => model.Name) %>
        </div>

        
        <div class="editor-label">
            <%: CRM.Resourses.Resourses.customerSAPnumber %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.NumberInSAP) %>
            <%: Html.ValidationMessageFor(model => model.NumberInSAP) %>
        </div>

       

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.StartDateWorkingWithProfine %>
        </div>
        <div class="editor-field">
             <%: Html.DevExpress().DateEdit(
                            settings => {
                                settings.Name = "DateStartProfineRUS";
                                settings.Properties.DisplayFormatString = "Y";
                                           
                            }
                        ).Bind(Model.DateStartProfineRUS).GetHtml() %>
        </div>

       
           

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.profineRegion %>
        </div>
        <div class="editor-field"> <% var col = new profineRegionsCollection(); %>
           <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdprofineRegion";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdProfineRegion";
                                                      
                                                      }).BindList(col.profineRegionsList).Bind(Model.IdprofineRegion).GetHtml()%> 
        </div>

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.customerByBuisiness %>
        </div>
        <div class="editor-field"> <% var col2 = new CustomerClassificationsByBusinessCollection(); %></>
            <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdCustomerClassificationsByBusiness";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdCustomerClassificationsByBusiness";
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                      }).BindList(col2.CustomerClassificationsByBusinessList).Bind(Model.IdCustomerClassificationsByBusiness).GetHtml()%>
        </div>

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.customerByDelegation %>
        </div>
        <div class="editor-field"><% var col3 = new CustomerClassificationsProfineCollection(); %>
            <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdCustomerClassificationsProfine";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdCustomerClassificationsProfine";
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                      }).BindList(col3.CustomerClassificationsProfineList).Bind(Model.IdCustomerClassificationsProfine).GetHtml()%> 
        </div>

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.customerByTurnover %>
        </div>
        <div class="editor-field"> <% var col4 = new CustomerClassificationsTurnoverCollection(); %>
             <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdCustomerClassificationsTurnover";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdCustomerClassificationsTurnover";
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                      }).BindList(col4.CustomerClassificationsTurnoverList).Bind(Model.IdCustomerClassificationsTurnover).GetHtml()%> 
        </div>

      

        <div class="editor-label">
            <%: CRM.Resourses.Resourses.customerManager %>
        </div>
        <div class="editor-field"><% var usrCol = new UsersCollection(); %>
            <%: Html.DevExpress().ComboBox(settings=>
                                                      {
                                                          settings.Name = "IdManager";

                                                          settings.Properties.TextField = "LocalizedFullName";
                                                          settings.Properties.ValueField = "IdUser";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                                                      }).BindList(usrCol.Managers).Bind(Model.IdManager).GetHtml()%> 
        </div>

        <p align="right">
            <input type="submit" value="<%: CRM.Resourses.Resourses.Save %>" />
        </p>
    </fieldset>
<% } %>



</asp:Content>
